/**
标题
 */

import React,{ Component } from 'react';
import {
Text,
View,
ScrollView,
Image,
TouchableWithoutFeedback,
TouchableOpacity,
Animated,
} from 'react-native'
import {styles}  from '../styles/listdetail';

export default class AroundView extends Component{
  constructor(props) {
    super(props);
    this.state={
       ...props,
       headHeight:new Animated.Value(0),
       groupHeight:new Animated.Value(0),
     };
     this.showorhide=0;
  }

  _showorhideItems(){
  	console.log(this.state)
  	
    if (this.state.headHeight._value == 0)
    {
      Animated.parallel([
        Animated.timing(          // Uses easing functions
           this.state.headHeight,    // The value to drive
           {
             toValue: 20
           }            // Configuration
         ),
        Animated.timing(          // Uses easing functions
          this.state.groupHeight,    // The value to drive
          {
            toValue: 250
          }            // Configuration
        )
      ]).start();

    }
    else if (this.state.headHeight._value == 20)
    {
      Animated.parallel([
        Animated.timing(          // Uses easing functions
           this.state.headHeight,    // The value to drive
           {
             toValue: 0
           }            // Configuration
         ),
        Animated.timing(          // Uses easing functions
          this.state.groupHeight,    // The value to drive
          {
            toValue: 0
          }            // Configuration
        )
      ]).start();
    }
  }
	 render () {
	 	return (
		    <View style={[styles.container,styles.titleMargin]}>
            <View style={styles.aroundHeight}>
              <Text style={styles.aroundTitle}>房源描述</Text>
              <View>
                <Animated.Text style={[styles.aroundList,{height:this.state.headHeight}]}>小区介绍</Animated.Text>
                <Text style={styles.aroundLine}>本房位于市中心内长宁繁华地段，地铁、公交选择众多，出行方便。长宁仙霞路住宅区，闹中取静，绿化率高，居住生活闲适之地。</Text>
              </View>
              <Animated.View style={{backgroundColor:'#fff',height:this.state.groupHeight}}>
                <Text style={styles.aroundList}> 描述</Text>
                <Text style={styles.aroundLine}>水仙楼位于仙霞路471弄。通过小区道路的合理组织，休闲设施的精心安排，提供自然、舒适的居住环境，房间水仙楼全部由盈家生活设计团队量身定制，液晶彩电、空调、洗衣机、油烟机等家电齐全，可直接拎包入住。房间装修精致别具，朝南采光特别好，敞亮干净。</Text>
                <Text style={styles.aroundList}>周边信息</Text>
                <Text style={styles.aroundLine}>周边缤谷广场、百盛购物中心虹桥店、南丰城、尚佳中心、友谊商城、天都国际、世贸商城、古北家乐福娱乐休闲逛街美食应有尽有。</Text>
              </Animated.View>

              <TouchableOpacity onPress={this._showorhideItems.bind(this)}>
  			    	<Image style={styles.aroundImg}
  			            source={require('../images/pull.png')}
  			        />
  		    	  </TouchableOpacity>
            </View>

		    </View>

		)
	 }

};
